/*
 * @Description:
 * @Author: 龙春雨
 * @Date: 2023-02-22 17:02:39
 */
export default {
  data() {
    return {
      tableData: [],
      page: {
        total: 0, // 总页数
        currentPage: 1, // 当前页数
        pageSizes: [15, 30, 45, 60, 75],
        pageSize: 15, // 每页显示多少条
      },
      searchForm: {},
      tableLoading: false,
    };
  },
  methods: {
    // searchChange(form = {}, done) {
    //   this.searchForm = form;
    //   this.page.currentPage = 1;
    //   this.getList(this.page, form);
    //   done && done();
    // },

    // 刷新回调
    refreshChange() {
      this.getList();
    },
    // 分页大小变化回调
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
      this.page.size = pageSize;
      this.page.current = 1;
      this.page.currentPage = 1;
      this.getList();
    },
    // 页码发生变化回调
    currentChange(page) {
      this.page.currentPage = page;
      this.page.current = page;
      this.getList();
    },
    // 点击搜索回调
    searchChange(params, done) {
      this.page.current = 1;
      this.page.currentPage = 1;
      this.searchForm = {};
      if (done) {
        done();
      }
      Object.keys(params).forEach((key) => {
        if (key.indexOf('$') === -1) {
          this.searchForm[key] = params[key];
        }
      });
      this.getList();
    },
    // 清空搜索回调
    searchReset() {
      this.searchForm = {};
      this.customFilter = {};
      this.getList();
    },
  },
  computed: {
    axiosPage() {
      return {
        size: this.page.pageSize,
        current: this.page.currentPage,
      };
    },
  },
};
